<?php

/*
	Class: Watch_Plugins_Feeds

	About: Author
		Rich Joslin

	About: License
		<http://communit.as/docs/license>
*/
class Watch_Plugins_Feeds {

	/* Group: Instance Methods */

	/*
		Function: inject
			Injects an array of feed items into a plugin param array.
			Can be used to place feeds or feedlets on various pages in a website.
	*/
	function inject($params) {
		if (array_key_exists('username', $params)) {
			$username = $params['username'];
			if (!is_null($username) && trim($username) != "") {
				$per_page = Cts_Registry::get('feed_item_count_on_home_page');
				$feeditems_table = new WatchFeedItems();
				$params['feeditems'] = $feeditems_table->getItemsPage($username, $per_page);
			}
		}
		return $params;
	}

}
